local CheckWidgetType = UI.CheckWidgetType
local CheckArgType = UI.CheckArgType
local CheckArgWidget = UI.CheckArgWidget
local MakeAccessor = UI.MakeAccessor
local MakeTypeSetter = UI.MakeTypeSetter

--[[ Slider @FIXME ]]--
local Slider = UI.NewWidgetType("Slider", "Frame")
Slider.parameters = {
	value = 0,
	min = 0,
	max = 0,
	step = 0,
        disabled = false,
	orientation = "HORIZONTAL",
}

function Slider:Initialize(o)
	local t = UI.params[o]
	assert(t)
end

UI.MakeTextureFunctions(Slider, "Slider", "Thumb")

MakeTypeSetter("Slider", "SetMinMaxValues", {"min", "max"}, {"number", "number"})
MakeTypeSetter("Slider", "SetValue", "value", "number")
MakeTypeSetter("Slider", "SetValueStep", "step", "number")
MakeAccessor("Slider", "GetMinMaxValues", {"min", "max"})
MakeAccessor("Slider", "GetValue", "value")
MakeAccessor("Slider", "GetValueStep", "step")

MakeAccessor("Slider", "GetOrientation", "orientation")

function Slider.prototype:SetOrientation(orientation)
	CheckWidgetType("Slider:SetOrientation", self, "Slider")
	assert(UI.ValidOrientationName[orientation], "Invalid orientation")
	UI.params[self].orientation = orientation
end


function Slider.prototype:Enable()
        UI.params[self].disabled = nil
end

function Slider.prototype:Disable()
        UI.params[self].disabled = true
end

UI.RegisterScriptHandlers(Slider, "OnValueChanged")
